package com.itheima.tliasmanager.controller;

import com.itheima.tliasmanager.pojo.Vo.ClazzVo;
import com.itheima.tliasmanager.pojo.Dto.GenderCount;
import com.itheima.tliasmanager.pojo.Vo.JobVo;
import com.itheima.tliasmanager.pojo.Vo.Result;
import com.itheima.tliasmanager.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RequestMapping("/report")
@RestController
public class ReportController {

    @Autowired
    private ReportService reportService;

    @GetMapping("/empJobData")
    public Result empJobReport() {
        log.info("统计各个职位的员工人数");
        JobVo jobVo = reportService.empJobReport();
        return Result.success(jobVo);
    }

    @GetMapping("/studentCountData")
    public Result studentCountReport() {
        log.info("统计每一个班级的人数");
        ClazzVo clazzVo = reportService.studentCountReport();
        return Result.success(clazzVo);
    }

    @GetMapping("/empGenderData")
    public Result empGenderReport() {
        log.info("统计员工性别信息");
        List<GenderCount> genderCountList = reportService.empGenderReport();

        return Result.success(genderCountList);
    }

    @GetMapping("/studentDegreeData")
    public Result studentDegreeReport() {
        log.info("统计学员的学历信息");
        List<GenderCount> genderCountList = reportService.studentDegreeReport();
        return Result.success(genderCountList);
    }
}
